package com.sylar.happyreader.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
	private static String name = "book.db";
	private static final int version = 2;
	public DatabaseHelper(Context context) {
		super(context, name, null, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String sql = "create table if not exists book(_id integer primary key autoincrement,bookname varchar,pageno varchar)";
		String h_sql = "create table if not exists bookhisory(_id integer primary key autoincrement,sex varchar,style varchar,bookname varchar)";
		try{
			db.execSQL(sql);
		}catch(Exception e){
			e.printStackTrace();
		}
		try{
			db.execSQL(h_sql);
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		
	}

}
